package com.asset.dispoal.defaultCompanyRole;

import com.asset.dispoal.defaultCompanyRole.api.IGbDefaultCompanyRoleService;
import com.asset.dispoal.defaultCompanyRole.dto.GbDefaultCompanyRoleRequest;
import com.asset.dispoal.defaultCompanyRole.dto.GbDefaultCompanyRoleResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.controller.BaseController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * 默认公司角色表控制层
 *
 * @author: mhuang
 * @date: 2022-03-17 14:54:00
 */
@RestController
@RequestMapping("gbDefaultCompanyRole")
@Api(value = "默认角色配置", tags = "默认角色配置")
public class GbDefaultCompanyRoleController extends BaseController {

    @Autowired
    private IGbDefaultCompanyRoleService gbDefaultCompanyRoleService;

    @Permission(code = "partners:role", param = "")
    @GetMapping(value = "/page")
    @ApiOperation(value = "查询", notes = "查询")
    public Result<PageVO<GbDefaultCompanyRoleResponse>> page(GbDefaultCompanyRoleRequest roleRequest) {
        return gbDefaultCompanyRoleService.queryPage(roleRequest);
    }

    @PostMapping(value = "/insert")
    @ApiOperation(value = "添加", notes = "添加")
    public Result insert(@RequestBody GbDefaultCompanyRoleRequest request) {
        final Result insert = gbDefaultCompanyRoleService.insert(request);
        return insert;
    }

    @PostMapping(value = "/update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody GbDefaultCompanyRoleRequest request) {
        final Result update = gbDefaultCompanyRoleService.update(request);
        return update;
    }

    @PostMapping(value = "/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(@RequestBody String id) {
        return gbDefaultCompanyRoleService.delete(id);
    }


}